{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">考试管理</li>
            <li class=""><a href="{:url('admin/exam/add')}">添加考试</a></li>
        </ul>
        <div class="layui-tab-content">

            <form id="form" class="layui-form layui-form-pane" action="{:url('admin/exam/index')}" method="get">
                <div class="layui-inline">
                    <label class="layui-form-label">班级</label>
                    <div class="layui-input-inline">
                        <select name="class_id">
                            <option value="0">全部</option>
                            {foreach name="class_list" item="vo"}
                            {if condition="($vo.id == $class_id)"}
                            <option value="{$vo.id}" selected>{$vo.class_name}</option>
                            {else/}
                            <option value="{$vo.id}">{$vo.class_name}</option>
                            {/if}
                            {/foreach}
                        </select>
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">考试名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="exam_name" value="{$exam_name}" placeholder="请输入考试名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn">搜索</button>
                </div>
            </form>
            <hr>
            <form action="" method="post" class="ajax-form">
                <div class="layui-tab-item layui-show">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th style="width: 10px;">ID</th>
                            <th style="width: 50px;">考试名称</th>
                            <th style="width: 50px;">班级</th>
                            <th style="width: 50px;">考试时间</th>
                            <th style="width: 100px;">创建人</th>
                            <th style="width: 100px;">备注</th>
                            <th style="width: 100px;">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist  name="exam_list" id="vo" empty="暂时没有数据"}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.exam_name}</td>
                            <td>{$vo.class_name}</td>
                            <td>{$vo.exam_date}</td>
                            <td>{$vo.username}</td>
                            <td>
                                <a href="javascript:;" class="open-content"
                                   onclick="more('{$vo.class_name}','{$vo.remark}')">{:cut_string($vo['remark'], 20)}</a>
                            </td>
                            <td>
                                <a href="{:url('admin/exam/edit',['id'=>$vo['id']])}"
                                   class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                                <a href="{:url('admin/exam/delete',['id'=>$vo['id']])}"
                                   class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                    <!--分页-->
                    {$exam_list->render()}
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    function more(class_name,remark){
        layer.open({
            type: 1,
            skin: 'open-class',
            title:[class_name + '-备注', 'font-size:18px;'],
            area: ['500px', '300px'],
            content: remark
        });
    }

</script>
{/block}